import service from '/@/utils/request';

export const storageApi = {
    listStorage: (query?: StorageQueryDto) => {
        return service.get<PageResult<StorageVo>, StorageQueryDto>('/admin/storage', {
            params:query
        });
    },
    listTypes: () => {
        return service.get<Array<StorageType>>('/admin/storage/types');
    },
    addStorage(storage: StorageAddDto) {
        return service.post<string, StorageAddDto>('/admin/storage', storage);
    },
    editStorage(storage: StorageUpdateDto) {
        return service.put<string, StorageUpdateDto>('/admin/storage', storage);
    },
    deleteStorage(storageId: number) {
        return service.delete<boolean>(`/admin/storage/${storageId}`);
    },
    activeStorage(storageId: number) {
        return service.post<string, StorageUpdateDto>(`/admin/storage/active/${storageId}`);
    },
    getStorage(storageId: number) {
        return service.get<StorageVo>(`/admin/storage/${storageId}`);
    }
}